import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    loaded: false,
    flow: false,
    uid: null,
    // apiOrigin: "http://ceodemo.hotkidclub.com:8290",
    apiOrigin: "http://ceoapi.hotkidclub.com:8280",
    apiPort: [
      "verityPage:/ceo/b/terminal/checkPostId/",
      "getVerityCode:/ceo/b/terminal/sendValidationCode",
      "verityPhone:/ceo/b/terminal/checkMobile/",
      "verityPhone:/ceo/b/terminal/checkMobile/",
      "verityCode:/ceo/b/terminal/checkMobileValidation/",
      "verityIDcard:/ceo/b/terminal/checkCardId/",
      "verityLisence:/ceo/b/terminal/checkLicenseId/",
      "submitData:/ceo/b/terminal/submitApplication",
      "wxSDK:/ceo/b/goldencalf/config",
    ],
  },
  mutations: {
    upload(state, {
      prope,
      data
    }) {
      if (prope.split('.').length == 1) state[prope.split('.')[0]] = data;
      if (prope.split('.').length == 2) state[prope.split('.')[0]][prope.split('.')[1]] = data;
      if (prope.split('.').length == 3) state[prope.split('.')[0]][prope.split('.')[1]][prope.split('.')[2]] = data;
      if (prope.split('.').length == 4) state[prope.split('.')[0]][prope.split('.')[1]][prope.split('.')[2]][prope.split('.')[3]] = data;
      if (prope.split('.').length == 5) state[prope.split('.')[0]][prope.split('.')[1]][prope.split('.')[2]][prope.split('.')[3]][prope.split('.')[4]] = data;
    }
  },
  actions: {}
});